package com.jzo2o.customer.controller.worker;

import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 服务端 - 银行账户信息相关接口
 */
@RestController("workerBankAccountController")
@RequestMapping("/worker/bank-account")
@Api(tags = "服务端 - 银行账户信息相关接口")
public class BankAccountController {

    @Resource
    private IBankAccountService bankAccountService;

    /**
     * 新增/更新银行账号信息接口
     * @param bankAccountUpsertReqDTO 新增/更新银行账号信息
     */
    @PostMapping("")
    @ApiOperation("新增/更新银行账号信息接口")
    public void upsertWorkerBankAccount(@RequestBody BankAccountUpsertReqDTO bankAccountUpsertReqDTO) {
        bankAccountService.upsertWorkerBankAccount(bankAccountUpsertReqDTO);

    }

    /**
     * 服务端 - 获取当前用户银行账号
     */
    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账号")
    public BankAccountResDTO currentUserBankAccount() {
        return bankAccountService.getCurrentUserBankAccount();
    }


}
